﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FisheryPlatform.Common
{
    public class ConvertUtility
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="value"></param>
        /// <param name="targetFullTypeName">目标类型</param>
        /// <returns></returns>
        public static object VariableValueTo(object value, string targetFullTypeName)
        {
            object result = null;
            switch (targetFullTypeName)
            {
                case "System.Byte": result = Convert.ToByte(value); break;
                case "System.Int32": result = Convert.ToInt32(value); break;
                case "System.Int64": result = Convert.ToInt64(value); break;
                case "System.String": result = Convert.ToString(value); break;
                case "System.Decimal": result = Convert.ToDecimal(value); break;
                case "System.Double": result = Convert.ToDouble(value); break;
                case "System.DateTime": result = Convert.ToDateTime(value); break;
            }

            return result;
        }
    }
}
